<?php

class ajoutOeuvre extends Controller {


	function index()
	{
		$this->load->database();
		$this->load->library('form_validation');
		$this->load->helper('form');
		$this->load->helper('url');
		$this->load->helper('path');
		
		$data="";
		
		if (isset($_COOKIE['login'])){
			
		$query = $this->db->query("SELECT ID_Exposition, nom FROM exposition where utilisateur ='".$_COOKIE['login']."'");

		foreach ($query->result_array() as $row)
		{
			$data["expositions"][]=array($row['ID_Exposition'],$row['nom']);
		}
		
		$query = $this->db->query("SELECT ID_Media, chemin FROM media where type ='image' && oeuvre is NULL && utilisateur ='".$_COOKIE['login']."'");
		
		foreach ($query->result_array() as $row)
		{
			$data["images"][]=array($row["ID_Media"],$row['chemin']);
		}
		 }
		$this->load->view('ajoutOeuvre',$data);
	}
	
	
	
	
}
?>
